]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
breakManager: Use uninhibitable idle watch
authorSebastian Keller <skeller@gnome.org>
Tue, 6 May 2025 00:40:18 +0000 (02:40 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 30 Jan 2026 14:10:51 +0000 (14:10 +0000)
If we use a regular idle watch, any session inhibitors can prevent the
watch from triggering, leading to the break manager to never consider
the break as having been completed until the inhibitor is gone. This
could lead to situations in which the system appears to be stuck with
a dimmed screen.

Also start the idle time when the idle watch is created, otherwise any
previous idle time would count towards it, causing the watch to trigger
early, leaving it inconsistent with the rest of the break manager state.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8378
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3709>

js/misc/breakManager.js
tests/unit/breakManager.js

index a72b9c109a550e17077db946fd3bade60c77c3e7..c90e0a9d558712a0e7415f69ae384fb54d6ef065 100644 (file)
@@ -26,6 +26,7 @@ import Cogl from 'gi://Cogl';
 import Gio from 'gi://Gio';
 import GLib from 'gi://GLib';
 import GObject from 'gi://GObject';
+import Meta from 'gi://Meta';
 import Shell from 'gi://Shell';
 import St from 'gi://St';
 
@@ -194,7 +195,10 @@ export const BreakManager = GObject.registerClass({
     }
 
     _startStateMachine() {
-        this._idleWatchId = this._idleMonitor.add_idle_watch(MIN_BREAK_LENGTH_SECONDS * 1000, this._onIdleWatch.bind(this));
+        this._idleWatchId = this._idleMonitor.add_idle_watch_full(
+            MIN_BREAK_LENGTH_SECONDS * 1000,
+            this._onIdleWatch.bind(this),
+            Meta.IdleMonitorWatchFlags.UNINHIBITABLE | Meta.IdleMonitorWatchFlags.START_NOW);
 
         this._state = BreakState.ACTIVE;
         this._currentBreakType = null;
index e74477696209f48b6e05d72ff99a9fa58150d681..96d6c6048c76f1f514293b7b2c48a74912ce5cd3 100644 (file)
@@ -209,7 +209,7 @@ class TestHarness {
     // simulated clock and event queue.
     get mockIdleMonitor() {
         return {
-            add_idle_watch: (waitMsec, callback) => {
+            add_idle_watch_full: (waitMsec, callback, _flags) => {
                 console.assert(this._idleWatch === null);
                 this._idleWatch = {
                     waitMsec,